package com.wind.trademark.base.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wind.trademark.base.dao.CategoryDao;
import com.wind.trademark.base.model.BsCategory;
import com.wind.trademark.base.service.CategoryService;
import com.wind.trademark.common.dao.BaseDao;
import com.wind.trademark.common.vo.ComboBean;
import com.wind.trademark.common.vo.PageBean;
import com.wind.trademark.common.vo.PageParam;






@Service
public class CategoryServiceImpl implements CategoryService{
	
	@Autowired
	private CategoryDao categorydao; 
	@Autowired
	private BaseDao baseDao;
	@Override
	public BsCategory saveCategory(BsCategory category) {
		return (BsCategory) baseDao.save(category);
	}
	@Override
	public void updateCategory(BsCategory category) {
		baseDao.saveOrUpdate(category);
	}
	@Override
	public PageBean queryCategory(PageParam pageParam,
			Map<String, Object> params) {
		return categorydao.queryCategory(pageParam, params);
	}
	@Override
	public void deleteCategory(Long id) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public BsCategory getCategory(Long id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void updateCategoryEnName(BsCategory category) {
		String enName=category.getEnName();
		category=baseDao.get(category.getClass(), category.getId());
		category.setEnName(enName);
		baseDao.saveOrUpdate(category);
	}
	@Override
	public List<ComboBean> goolgeL2Category(String queryParam) {
		return categorydao.goolgeL2Category(queryParam);

	}
	@Override
	public List<ComboBean> goolgeL1AndL2Category(Map<String, Object> params) {
		return categorydao.goolgeL1AndL2Category(params);
	}

	@Override
	public List<BsCategory> getL1AndL2Category() {
		return categorydao.getL1AndL2Category();
	}
	@Override
	public List<ComboBean> getL2Category() {
		return categorydao.getL2Category();
	}
	@Override
	public void deleteCategories(List<Long> ids) {
		categorydao.deleteCategories(ids);
	}
	@Override
	public BsCategory saveOrUpdateCategory(BsCategory category) {
		 baseDao.saveOrUpdate(category);
		 return category;
	}
	@Override
	public BsCategory loadCategory(Long id) {
		return baseDao.get(BsCategory.class, id);
	}


	
} 